import request from "@/utils/request";
import requestMock from "@/utils/jsonserver";
// 获取商品详情
export function getGoodsDetailApi(skuId) {
  return request.get(`/item/${skuId}`);
}
// 添加购物车
export function addShopCart(skuId, skuNum) {
  return request.post(`/cart/addToCart/${skuId}/${skuNum}`);
}

// ============ json-server ==============

// 添加一条数据
export const reqAddData = (data) =>
  requestMock({
    url: "/data",
    method: "post",
    data,
  });
// 修改数据
export const requpdateData = (id, obj) =>
  requestMock({
    url: `/data/${id}`,
    method: "patch",
    data: obj,
  });
// 查询数据
export const reqFindData = (id) =>
  requestMock({
    url: `/data/${id}`,
    method: "get",
  });
